//
//  ZYCAttendanceEvaluateDetailCell.m
//  ZDSC
//
//  Created by ZDTX on 2021/8/3.
//

#import "ZYCAttendanceEvaluateDetailCell.h"
#import "ZYCTeachingEvaluatedDetailModel.h"

@interface ZYCAttendanceEvaluateDetailCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *scoreLabel;
@property (nonatomic, strong) UILabel *line;
@property (nonatomic, strong) UILabel *contentLabel;


@end
@implementation ZYCAttendanceEvaluateDetailCell

- (void)setIsHid:(BOOL)isHid{
    _isHid = isHid;
    _scoreLabel.hidden = YES;
}

- (void)setContentString:(NSString *)contentString{
    _contentString = contentString;
    _contentLabel.text = contentString;
}

- (void)setTitleString:(NSString *)titleString{
    _titleString = titleString;
    _titleLabel.text = titleString;
}
- (void)setModel:(ZYCTeachingEvaluatedSingleModel *)model{
    _model = model;
    _titleLabel.text = model.project;
    _scoreLabel.text = [NSString stringWithFormat:@"%@分",model.doScore];
    _contentLabel.text = model.explainDesc;
}



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.scoreLabel];
        [self.contentView addSubview:self.line];
        [self.contentView addSubview:self.contentLabel];

        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.equalTo(self.contentView).offset(15.0f);
        }];
        [self.scoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView).offset(-15.0f);
            make.centerY.equalTo(self.titleLabel);
        }];
        
        [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15.0f);
            make.right.equalTo(self.contentView).offset(-15.0f);
            make.top.equalTo(self.titleLabel.mas_bottom).offset(15.0f);
            make.height.mas_equalTo(0.5f);
        }];
        
        [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15.0f);
            make.right.equalTo(self.contentView).offset(-15.0f);
            make.top.equalTo(self.line.mas_bottom).offset(16.0f);
            make.bottom.equalTo(self.contentView).offset(-15.0f);
        }];
    }
    return self;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Light", 16.0f) titleColor:HEX_RGB(@"#2B302D") textAlignment:ZZTextAlignmentLeft];
    }
    return _titleLabel;
}

- (UILabel *)scoreLabel{
    if (!_scoreLabel) {
        _scoreLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Light", 16.0f) titleColor:HEX_RGB(@"#39A85B") textAlignment:ZZTextAlignmentRight];
    }
    return _scoreLabel;
}



- (UILabel *)line {
    if (!_line) {
        _line = [[UILabel alloc] init];
        _line.backgroundColor = HEX_RGB(@"#EBEBEB");
    }
    return _line;
}



- (UILabel *)contentLabel {
    if (!_contentLabel) {
        _contentLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Light", 16.0f) titleColor:HEX_RGB(@"#999999") textAlignment:ZZTextAlignmentLeft];
        _contentLabel.numberOfLines = 0;
    }
    return _contentLabel;
}


@end
